<template>
	<div class="inner-content">
		<div class="title">
			押金订单
		</div>

		<el-row class='edit-tool'>
			<el-select v-model='status' @change='handleChange'>
            	<el-option label='全部' :value='3'></el-option>
            	<el-option label='未处理' :value='0'></el-option>
            	<el-option label='已接受' :value='1'></el-option>
            	<el-option label='已拒绝' :value='2'></el-option>
            </el-select>

            <el-select v-model='type' @change='handleChange'>
            	<el-option label='用户' :value='1'></el-option>
            	<el-option label='送水工' :value='2'></el-option>
            </el-select>
        </el-row>

        <el-table :data='userData'
        	v-show='type === 1'>
        	<el-table-column label='订单号'
        		prop='userDepositOrderId'
        		width='220'>
        	</el-table-column>

        	<el-table-column label='名字'
        		prop='name'
        		width='160'>
        	</el-table-column>

        	<el-table-column label='ID号'
        		prop='userId'
        		width='235'>
        	</el-table-column>

        	<el-table-column label='申请日期'
        		width='180'>
        		<template scope='scope'>
        			{{$$formatTime2(scope.row.createTime)}}
        		</template>
        	</el-table-column>

        	<el-table-column label='接收日期'
        		width='180'>
        		<template scope='scope'>
        			{{$$formatTime2(scope.row.receiveTime)}}
        		</template>
        	</el-table-column>

        	<el-table-column label='金额'
        		width='80'>
        		<template scope='scope'>
        			￥{{scope.row.deposit}}
        		</template>
        	</el-table-column>

        	<el-table-column label='空桶数'
        		width='80'
        		prop='amount'>
        	</el-table-column>

        	<el-table-column label='状态'
        		width='200'>
        		<template scope='scope'>
        			<div v-if='scope.row.status !== 0'>
	        			{{scope.row.status === 1 ? '已接受' : '已拒绝'}}
        			</div>
        			<div v-else>
	        			<el-button type='primary'
	        				@click='handleUser(scope.row, 1)'>
	        				接收
	        			</el-button>
	        			<el-button @click='handleUser(scope.row, 2)'>
	        				拒绝
	        			</el-button>
        			</div>
        		</template>
        	</el-table-column>
        </el-table>

        <el-table :data='deliverData'
        	v-show='type === 2'>
        	<el-table-column label='订单号'
        		prop='waterDeliverDepositOrderId'
        		width='200'>
        	</el-table-column>

        	<el-table-column label='名字'
        		prop='name'
        		width='100'>
        	</el-table-column>

        	<el-table-column label='ID号'
        		prop='waterDeliverId'
        		width='200'>
        	</el-table-column>

        	<el-table-column label='申请日期'
        		width='180'>
        		<template scope='scope'>
        			{{$$formatTime2(scope.row.createTime)}}
        		</template>
        	</el-table-column>

        	<el-table-column label='接收日期'
        		width='180'>
        		<template scope='scope'>
        			{{$$formatTime2(scope.row.receiveTime)}}
        		</template>
        	</el-table-column>

            <el-table-column label='提现类型'
                width='120'>
                <template scope='scope'>
                    {{scope.row.withdraw_target === 0 ? '押金' : '保证金'}}
                </template>
            </el-table-column>

        	<el-table-column label='金额'
        		width='120'>
        		<template scope='scope'>
        			￥{{scope.row.deposit }}
        		</template>
        	</el-table-column>

        	<el-table-column label='空桶数'
        		width='120'
        		prop='amount'>
        	</el-table-column>

        	<el-table-column label='状态'
        		width='200'>
        		<template scope='scope'>
        			<div v-if='scope.row.status !== 0'>
	        			{{scope.row.status === 1 ? '已接受' : '已拒绝'}}
        			</div>
        			<div v-else>
	        			<el-button type='primary'
	        				@click='handleDeliver(scope.row, 1)'>
	        				接收
	        			</el-button>
	        			<el-button @click='handleDeliver(scope.row, 2)'>
	        				拒绝
	        			</el-button>
        			</div>
        		</template>
        	</el-table-column>
        </el-table>

        <el-pagination
        	@current-change='handlePageChange'
        	:page-size='size'
        	:total='total'
        	layout='prev, pager, next, jumper'
        	:current-page='page'
        	style='margin-top: 20px;'>
        </el-pagination>

        <el-dialog :visible.sync='tipsVisible'  
            title='提示'
            :modal='false'>
            <span>请在设置支付密码后进行提现操作</span>
            <span  slot='footer'>
                <el-button @click='tipsVisible=false'>暂不设置</el-button>
                <el-button type='primary' @click='$router.push("/account/modifyPwd/pay")'>立即设置</el-button>
            </span>
        </el-dialog>

        <el-dialog :visible.sync='withdrawVisible'
          	class='dialog-withdraw'
          	title='支付宝支付'
          	style='text-align:center;'
          	:modal='false'
          	>
          	<el-form label-width='80px'
          		label-position='left'
          		:model='payForm'
          		:rules='payRules'
          		ref='payForm'>
	          	<el-form-item label='支付密码' prop='pwd'>
	          		<el-input v-model='payForm.pwd' type='password'></el-input>
	          	</el-form-item>

	          	<el-form-item>
	          		<el-button type='primary' @click='postPwd'>确定</el-button>
	          	</el-form-item>
          	</el-form>
        </el-dialog>
	</div>
</template>

<script>
	module.exports = require('./Deposit.js');
</script>

<style scoped lang='less'>
	.inner-content {
	    position: relative;
	}
	.edit-tool {
	    position: absolute;
	    top: 25px;
	    right: 40px;
	    .el-checkbox {
	        line-height: 36px;
	    }
	    .el-button {
	        margin-left: 20px;
	    }
	    input {
	        &::-webkit-input-placeholder {
	            color: #99A9BF;
	        }
	    }
	}
	.el-pagination {
	    text-align: center
	}
	.el-select {
	    width: 100px;
	}
</style>